package demo.connectsrc;

import org.apache.flink.api.common.functions.RichMapFunction;

import demo.base.connect.OrderAddress;

public class OrderAddressMapFunction extends RichMapFunction<String, OrderAddress> {

    @Override
    public OrderAddress map(String value) throws Exception {
        String[] splits = value.split(",");
        if (splits.length != 3) {
            System.out.println("OrderAddressMapFunction input error:" + value);
            return OrderAddress.empty();
        } else {
            return OrderAddress.of(splits[0], splits[1], splits[2]);
        }
    }
}
